#! /bin/sh

sudo tunctl -u root -t tap0
sudo ifconfig tap0 192.168.1.1 promisc up
sudo route add -net 192.168.1.0 netmask 255.255.255.0 dev tap0
sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
sudo netfilter-persistent save

sudo qemu-system-arm \
        -M vexpress-a9 \
        -m 512M \
        -kernel vexpress-v2p-ca9/arch/arm/boot/zImage \
        -dtb vexpress-v2p-ca9/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \
		-net tap,ifname=tap0,script=no,downscript=no \
		-net nic,macaddr=00:16:3e:00:00:01 \
        -nographic \
        -append "root=/dev/nfs rw
		nfsroot=192.168.1.1:/sync/rootfs,proto=tcp,nfsvers=3,nolock
		init=/linuxrc console=ttyAMA0 ip=192.168.1.100" \
